<div id="<?php echo $uniqid;?>" style="padding:5px">
    <table border="0" width="100%" cellspacing="1" cellpadding="5" class="formtable">
        <tr bgcolor="#FFFFFF">
            <td class="tlabel" >名称：</td>
            <td><input type="text"
                       class="forminput inputstyle validatebox-text textbox-prompt easyui-validatebox"
                       placeholder="请输入名称.."  v-model="params.name"/>
            </td>
        </tr>
        <tr bgcolor="#FFFFFF" style="display: none">
            <td class="tlabel" >模板类型：</td>
            <td>
                <el-radio-group v-model="params.type">
                    <el-radio label="shop">商城模板</el-radio>
                    <el-radio label="custom">自定义页面</el-radio>
                </el-radio-group>
            </td>
        </tr>
        <tr bgcolor="#FFFFFF" v-if="params.id>0">
            <td class="tlabel" >状态：</td>
            <td>
                <el-radio-group v-model="params.status">
                    <el-radio label="normal">上架</el-radio>
                    <el-radio label="hidden">下架</el-radio>
                </el-radio-group>
            </td>
        </tr>
        <tr bgcolor="#FFFFFF">
            <td class="tlabel" >备注：</td>
            <td>
                <textarea
                        rows="5"
                        v-model="params.memo"
                        class="form-control"
                        style="height: 100px; width: 400px;"
                        placeholder-style="color:#B1B3C7"
                        placeholder="请输入描述..."
                ></textarea>
            </td>
        </tr>
        <tr bgcolor="#FFFFFF">
            <td class="tlabel" >平台：</td>
            <td>
                <el-checkbox-group v-model="platform">
                    <el-checkbox label="H5">H5</el-checkbox>
                    <el-checkbox label="wxOfficialAccount">微信公众号网页</el-checkbox>
                    <el-checkbox label="wxMiniProgram">微信小程序</el-checkbox>
                    <el-checkbox label="App">App</el-checkbox>
                </el-checkbox-group>
            </td>
        </tr>
        <tr bgcolor="#FFFFFF">
            <td class="tlabel" >排序：</td>
            <td><input type="text"
                       class="forminput inputstyle validatebox-text textbox-prompt easyui-validatebox"
                       placeholder="请输入排序.." v-model="params.weigh" /></td>
        </tr>
    </table>
</div>
<script>
    var decorateeditVm = new Vue({
        el: '#<?php echo $uniqid;?>',
        data: {
            platform: [],
            params: JSON.parse("<?php echo addslashes($dataset);?>"),
        },
        mounted() {
            this.init();
        },
        methods: {
            init(){
                this.platform = this.params.platform.split(',');
            },
            submit(){
                decorateeditVm.params.platform = this.platform.join(',');
                let act = decorateeditVm.params.id>0 ? 'edit' : 'add';
                $.post('/admin/decorate/' + act, decorateeditVm.params, function (data) {
                    if (parseInt(data.ret) === 0) {
                        $.messager.show({
                            title: '提示',
                            msg: data.msg,
                            timeout: 3000,
                            showType: 'slide'
                        });
                        $("#decorateDlg").dialog('close');
                        $("#decoratecustomDlg").dialog('close');
                        if (typeof decorateReload == "function") {
                            decorateReload();
                        }
                        if (typeof decoratecustomReload == "function") {
                            decoratecustomReload();
                        }
                    } else {
                        $.messager.alert('提示', data.msg, 'warning');
                    }
                }, 'json');
            }
        }
    });
    $(function () {
        $('#decoratesubmit').click(function () {
            decorateeditVm.submit();
        });
    });
</script>
